// load GLC
// read font
// gen tex

// so, there is the way:
/**
 * 1.gen fontitem-list
 * 2.shader fontitem-list
 * 3.insert them into preview's font texture
 * */

// the fake code like this:
/**
 * lock the getlistindex
 * fetch the data of getllistindex&process
 * get a texture space then shader the data
 * joint the new texture to center font texture space
 * */
#define LCCTOOLBOX_DLL_IMPORT_LENCUCU
#define LCCTOOLBOX_DLL_IMPORT_LCCTOOLBOX
#include<ALLINALL.hpp>
#include<lencucuCandy.hpp>
#define DLL_IMPORT_TTFPARSER
#include<ttfParser/include/ttfParser.hpp>
#include<dataTransformer/include/bezier.hpp>
#include<dataTransformer/include/extremeNhorz.hpp>
using namespace Lencucu;
using namespace Lencucu::Candy;
using namespace LccStuffCollector;
#ifdef _WIN32
#pragma comment(lib,"lencucu")
#pragma comment(lib,"ttfParser")
#endif


class GLobjSlotsT
{	block<mark> bufferSlots;
	block<mark> arraySlots;
	block<mark> indexSlots;
public:
	// mark& buffer(size_t i);// auto gen the index of i GLobj
	// mark& array(size_t i);
	// mark& index(size_t i);
	// ~GLobjSlotsT();
}GLobjSlots;

struct styleSetting{
	// GLpart
	mark fontTexture;

	// DSpart
	originstr vtx;
	originstr frg;
	originstr gom_loop;
	originstr frg_scan;

	// map unicode <-> texcoord
private:
	map<unicode,size_t> texCoordIndexMap;
public:
	// [ alian|size|... info ]
	struct outlineType{union{int x;int w;};union{int y;int h;};};
	typedef outlineType coordType;
	const outlineType texOutline;
	const outlineType glyphOutline;
	coordType operator++();// alloc an area for new glyph
	void operator--();// dealloc ...
	coordType getCoord(unicode);
};


class ttfTexGenerator{
	// glyfItem::points final_points;
	// DataPacket fontdp;
	// fontdp.unitline_p=&final_points;
	// ShaderPacket fontsp;
	// fontsp.vtx="xxx";
	// fontsp.frg="xxx";
	// readPacket(...);
	mark shader_loop;
	mark shader_point;
	mark shader_scan;

	mark glyphUnitFrame;
	mark glyphClusterFrame;

	mark board;

	LccStuffCollector::TTFParser::ttfParser parser;
public:
	const volatile GmarkSetAuto<styleSetting> styleSettings;
	template<class T> size_t render( T&& note, LccStuffCollector::TTFParser::unicodes line, LccToolbox::block<size_t>* texCordInds_p=nullptr);
	///// if want use the font, just bind the specific texture and call texture() from shader
}ttfBar;


#include"fontTexGenerator.inl"